/*
 * Licensed to the Apache Software Foundation (ASF) under one or more
 * contributor license agreements. See the NOTICE file distributed with this
 * work for additional information regarding copyright ownership. The ASF
 * licenses this file to you under the Apache License, Version 2.0 (the
 * "License"); you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
 * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
 * License for the specific language governing permissions and limitations under
 * the License.
 */

package com.allyes.flume.source;

import java.util.Arrays;
import java.util.HashSet;
import java.util.Set;

public class TaildirSourceConfigurationConstants {

  public static final String TXT_INODE = "inode";
  public static final String TXT_POS = "pos";
  public static final String TXT_LINE_INDEX = "lineIndex";
  public static final String TXT_FILE = "file";
  public static final String TXT_PATH = "path";
  public static final String TXT_FILE_NAME = "fileName";
  public static final String TXT_BYTE_OFFSET = "byteOffset";
  public static final String TXT_DYNAMIC_HEADERS = "dynamicHeaders";

  public static final Set<String> allDynamicHeaders = new HashSet<String>(
      Arrays.asList(
          TXT_INODE,
          TXT_PATH,
          TXT_FILE_NAME,
          TXT_LINE_INDEX,
          TXT_BYTE_OFFSET));

  /** Mapping for tailing file groups. */
  public static final String FILE_GROUPS = "filegroups";
  public static final String FILE_GROUPS_PREFIX = FILE_GROUPS + ".";

  /** Mapping for putting headers to events grouped by file groups. */
  public static final String HEADERS_PREFIX = "headers.";

  /** Path of position file. */
  public static final String POSITION_FILE = "positionFile";
  public static final String DEFAULT_POSITION_FILE = "/.flume/taildir_position.json";

  /** What size to batch with before sending to ChannelProcessor. */
  public static final String BATCH_SIZE = "batchSize";
  public static final int DEFAULT_BATCH_SIZE = 100;

  /** Time (ms) to close idle files. */
  public static final String IDLE_TIMEOUT = "idleTimeout";
  public static final int DEFAULT_IDLE_TIMEOUT = 120000;

  /** Interval time (ms) to write the last position of each file on the position file. */
  public static final String WRITE_POS_INTERVAL = "writePosInterval";
  public static final int DEFAULT_WRITE_POS_INTERVAL = 3000;
}
